Premier, 1995

Exploring the new Object Navigator

By Jeff Warner

One of the most important new features in Developer/2000 is Object Navigator. In addition to providing a common interface across applications and operating systems, it makes creating and managing complex applications easier than ever before. In this article, we'll explore Object Navigator and show you how it works with Developer/2000 Reports Designer.

What is Object Navigator?

One of the major components of Developer/2000 and Designer/2000 is Object Navigator. Figure A shows Object Navigator from Reports Designer with a small report loaded. As you can see, Object Navigator displays the pieces of your project in an object hierarchy. This structure lets you see the entire project and then zoom in on details for a closer look. Let's examine Object Navigator in more detail.

Object Navigator is made up of nodes that represent objects. In this Object Navigator, nodes and objects are used interchangeably. Each node has a + or - before its name to indicate a collapsed or expanded state. A gray + next to a node (like External Queries in Figure A) means the node doesn't have any lower-level nodes. A round bullet indicates the object cannot have any lower-level nodes (the object is atomic in object-speak).

The node at the top of the Object Navigator window will be one of the following, depending on the type of project you're working on:

In addition, three nodes are common to all the project types: Libraries, Built-in Packages, and Database Objects. We'll explain their use in a future issue.

A tool palette appears along the left side of the Object Navigator window. The most commonly used icons in the tool palette are the traffic light (which runs the application) and the plus icon (which creates a new object). The tool palette also provides icons that enable you to save your project to disk, open a new project, and print out the project. Some of the graphics might be obscure, but fortunately, Developer/2000 provides hints under Windows. To activate hints, position the mouse over the icon for a second, and a small window will appear next to the button with a short description of what the button does. At the bottom of the window, Object Navigator displays a longer explanation for the button.

In our example using Reports Designer, we'll concentrate on the Reports node and examine the major objects that make up the Reports Object. We'll examine Object Navigator in the other tools in the future.

The Reports Object

To proceed with our example, start Reports Designer and log in to the sample database on your server. Object Navigator will display the expanded Reports Object at the top of the screen along with the other high-level objects, including:

To explore Object Navigator, we'll use Reports Designer to create a Sales by State report using the tables from the Browser user. We'll show how using Object Navigator increases the ease of use of Reports Designer and reduces the complexity of tracking the pieces of data that make up the report.

The report will consist of two major objects: a data model and a layout. We'll use Object Navigator to create and manipulate the objects to create the report.

The Data Model

First, we must create a Data Model of the report. The Data Model Object is responsible for getting the data from the database and making it available to the Layout Object. Let's create a Data Model for this report.

Select the Data Model node and under Tools, select Data Model Editor (or click the right mouse button and select Editor from the pop-up menu). Object Navigator will bring up the Data Model window where we will set up the SQL for the report. From the tool palette, select the SQL button. Using the mouse, click and drag to create a rectangle to the right of the toolbar. The rectangle is actually a Query Object named Q_1. When finished, it should look like Figure B.

Now double-click on the new Query Object to open the Properties window. We need to name this Query Object and then set up how it will access data. To name the query, change the Name to Q_SALES_BY_STATE. Now to set up data access, click on the Select Statement box and type the following text:

select

state, count(*)

from

browser.customer cc,

browser.sales_order sc

where

cc.customer_id = sc.customer_id

group by

state

This simple query joins two tables and counts the number of orders per state. When you finish typing it, click OK; the Data Model should look like Figure C. We need to create the report's Layout Object, but first we should save the report. Go ahead and close the Data Model window. Select the Untitled node in the Object Navigator and then to save the report, select Save from the File menu. Reports Designer will display a small window. Just click OK, and the normal Windows File Save window will appear. Name your project Sales and click the OK button.

Creating a Layout Object

The Layout Object controls what the report will look like when you generate it. It also allows some control over what data will be displayed when you run the report. You can display data from only the database that's in the Data Model Object, but the Layout Object doesn't force you to display everything you get out of the Data Model. The Layout Object also supports six default layouts including mailing labels, master/detail reports, and matrix-style reports. We'll create a simple Layout Object and test it with our Data Model.

Use Object Navigator to select the Layout node. Click the right mouse button and select Editor from the pop-up menu. Object Navigator displays a blank layout window. Let's start with a default report. Select the Additional Default Layout button from the tool palette (it's the last one on the left). Starting down 1" and right 1", click and drag to draw a rectangle 1" tall by 2" wide to the right of the tool palette. In the Default Layout window, select the Tabular layout and then click on the Data/Selection tab. In the Count column, change the width from 40 to 5 and press OK. Report Designer will shrink the rectangle to hold the two columns. Your layout should now look like Figure D.

To finish the layout, we need to add a title. Click the text button, and click and draw a 1" by 2" rectangle near the top of the window. Type Sales by State and then click on the pointer button on the tool palette. Click on the new text box and in the Format menu, select Font to change the font to Ariel at 16 points. Also in the Format menu, select Bevel and change it to Inset. You might have to resize the rectangle to show all of your text. The layout is ready for testing, so in the File menu select Run. On the Runtime Parameter form, make sure the Destination Type is Screen and click Run Report to view your finished report, shown in Figure E.

In our next issue, we'll integrate graphics into this report to make it more visually appealing and to show you how to mix graphical and text information in a report.

Managing complexity

The Object Navigator not only makes it easier to get your work finished, it also helps reduce the amount of complexity you have to deal with. The object hierarchy allows you to focus your efforts because you only have to look at what you're working on. It also makes it easy to work with other objects in the project because you use the mouse to scroll through the windows instead of using a lot of keystrokes to accomplish the same task. An additional bonus is that the Object Navigator is used on other Developer/2000 tools, so you can apply what you learn on one tool to another--and that should help you get your job finished faster.

Jeff Warner is editor-in-chief of Exploring Oracle Developer/2000 and Designer/2000. You can reach him at exploring_oracle@merlin.cobb.ziff.com.


[Return to Index for Exploring Oracle Developer/2000 and Designer/2000 - Premier 1995]

Copyright (c) 1995 The Cobb Group, a division of Ziff-Davis Publishing Company. All rights reserved.

Reproduction in whole or in part in any form or medium without express written permission of Ziff-Davis

Publishing Company is prohibited. The Cobb Group and The Cobb Group logo are trademarks of

Ziff-Davis Publishing Company.

Exploring Oracle Developer/2000 and Designer/2000 is a publication of The Cobb Group.
1-800-223-8720